<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!DOCTYPE HTML>
<html lang="zh-CN">
<head>
	<meta charset="UTF-8">
	<title>凯盛项目管理系统</title>
	<link rel="stylesheet" type="text/css" href="css/bootstrap.min.css" />
	<link rel="stylesheet" type="text/css" href="css/style.css">
	<style>
    body{
        width: 960px;
        margin-left: auto;
        margin-right: auto;
    }
  </style>
</head>
<body class="body">
	<% pageContext.setAttribute("left", "document"); %>
	<%@include file="include/top.jsp" %>
	
	<div class="container" style="padding-top:10px">
	  <div class="row">
		<div class="span3">
			<%@include file="include/left.jsp" %>
		</div>
		<div class="span9">
			<ul class="breadcrumb" style="margin-bottom:0px;border-radius: 3px 3px 0 0;margin-top:15px">
				<li class="active">
					<a href="document.jsp"><i class="icon-folder-open"></i>资料</a>
				</li>
				<li class="pull-right"><i class="icon-plus"></i><a href="newDocument.jspx" class="link-black">分享新资料</a></li>
			</ul>
			<div class="wall" style="margin-bottom:20px;">
				<c:if test="${not empty documentmes }">
					<div class="alert alert-success">
		              <button type="button" class="close" data-dismiss="alert">×</button>
		              <strong>${documentmes }</strong>
		            </div>
		            <%
		            	request.getSession().removeAttribute("documentmes");
		            %>
				</c:if>
				<c:choose>
					<c:when test="${page.totalCount == 0 }">
						<h3 style="color:white">尚未分享任何资料，赶快来分享你的资料吧</h3>
					</c:when>
					<c:otherwise>
						<c:forEach items="${page.list }" var="s">
							<blockquote>
							  <h3><a href="documentShow.jspx?id=${s.id }">${s.title }</a></h3>
							  <p style="font-size:14px;line-height:1.5;">${s.content }</p>
							 <small style="margin-left:300px;float:right;margin-right:100px;">${s.user.username }发布于 ${s.viewcreatetime }</small>
								  <c:if test="${curr_user.id == s.userId }">
								  	<a href="editDocument.jspx?id=${s.id }" role="button" data-toggle="modal"><i class="icon-pencil"></i></a>&nbsp;&nbsp;&nbsp;
								  	<a href="javascript:0;" title="删除" class="mya" value="${s.id }"><i class="icon-trash"></i></a>
								  </c:if>
							</blockquote>
						</c:forEach>
					</c:otherwise>
				</c:choose>
				
				<c:choose>
					<c:when test="${page.totalCount == 0 }">
					
					</c:when>
					<c:otherwise>
						<%@include file="include/page.jsp" %>
					</c:otherwise>
				</c:choose>
				<div class="clear"></div>
			</div>
		</div>
		
	  </div>
	</div>

	<script type="text/javascript" src="js/jquery.min.js"></script>
	<script type="text/javascript" src="js/bootstrap.min.js"></script>
	<script type="text/javascript">
		$(document).ready(function(){
			$(document).ready(function(){
			$(".mya").click(function(){
				var documentId = $(this).attr("value");
				if(confirm("真的要删除资料么？")){
					location.href="delDocument.jspx?id="+documentId;
				}
			});
		});
		});
	</script>

</body>
</html>